<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
<script type="text/javascript" src="../lib/html5.js"></script>
<script type="text/javascript" src="../lib/respond.min.js"></script>
<script type="text/javascript" src="../lib/PIE_IE678.js"></script>
<![endif]-->
    <link href="../lib/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="../lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
    <link href="../lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
    <!--[if IE 6]>
<script type="text/javascript" src="../lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
    <title>生产农事</title>
</head>
<body>
    <div class="pt-5  pl-20 pr-20 pb-20">
        <form id="itemEdit" name="itemEdit" method="post" action="../ashx/spui.ashx" class="form form-horizontal">
            <input type="hidden" class="actionValue" id="editAction" name="action" value="add" />
            <input type="hidden" id="id" name="id" />
            <input type="hidden" id="actionaddlistids" name="actionaddlistids" value="ftaskid,finfoid,finfofv1,finfonv1" /><!--当为批量操作时（批量插入时）这几个数据为,分隔处理，作业批量的依据-->
            <input type="hidden" id="tablename" name="tablename" value="" />
            <input type="hidden" id="tablemidname" name="tablemidname" value="" />
            <input type="hidden" id="dataneedtouser" name="dataneedtouser" value="1" /><!--是否要包含通用数据必归属处理-->
            <!-- <input type="hidden" id="finfoid" name="finfoid" value="" />-->
            <input type="hidden" id="finfofv1" name="finfofv1" value="" />
            <!--<input type="hidden" id="finfonv1" name="finfonv1" value="地MJ" />-->

            <input type="hidden" id="ftaskid" name="ftaskid" value="0" />

            <div id="tab-category" class="HuiTab">
                <div class="tabBar cl" id="tab-categorybar">
                    <span>
                        <label id="lb_worktypeshow">作业基本信息</label></span><span>作业图片信息</span><span>作业用料信息</span>
                </div>
                <div class="tabCon" id="divtab1">
                    <div id="divshow1">
                        <div class="row cl">
                            <label class="form-label col-1">作业类型：</label>
                            <div class="formControls col-2 layui-form" readonly="readonly">
                                <select name="finfotypeid" id='finfotypeid' lay-filter="finfotypeid" lay-search="" readonly="readonly">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <!-- <input type="hidden" id="finfotypeid" name="finfotypeid" value="" />-->
                                <input type="hidden" id="finfotypename" name="finfotypename" value="" />
                                <input type="hidden" id="finfotype" name="finfotype" value="" />
                                <input type="hidden" id="finfobytype1" name="finfobytype1" value="" />
                            </div>
                            <label class="form-label col-1">作业面积：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfonv1" id="finfonv1" placeholder="作业面积" value="0"  />
                            </div>
                            <label class="form-label col-1">天气状况：</label>
                            <div class="formControls  skin-minimal col-5">
                                <div class="radio-box">
                                    <input type="radio" id="finfofv4" name="finfofv4" value="晴天" class="hcradio" checked="checked" />
                                    <label for="finfofv4">晴天</label>
                                </div>
                                <div class="radio-box">
                                    <input type="radio" id="finfofv42" name="finfofv4" value="阴天" />
                                    <label for="finfofv42">阴天</label>
                                </div>
                                <div class="radio-box">
                                    <input type="radio" id="finfofv43" name="finfofv4" value="雨天" />
                                    <label for="finfofv43">雨天</label>
                                </div>
                                <div class="radio-box">
                                    <input type="radio" id="finfofv44" name="finfofv4" value="其它" />
                                    <label for="finfofv44">其它</label>
                                </div>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1">地块信息：</label>
                            <!--  <div class="formControls col-3">
                                <input type="text" class="input-text" name="fmaindcinfo" id="fmaindcinfo" readonly="readonly" placeholder="右边选择或搜索选择" />
                            </div>-->
                            <div class="formControls col-4  layui-form">
                                <select name="finfoid" id='finfoid' lay-filter="finfoid" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>

                            <label class="form-label col-1">任务信息：</label><div class="formControls col-3">
                                <input type="text" class="input-text" name="fthistaskinfo" id="fthistaskinfo" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <div class="formControls col-3  layui-form">
                                <select name="selecttaskinfo" id='selecttaskinfo' lay-filter="selecttaskinfo" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>

                            </div>
                            <div class="col-1"></div>
                        </div>

                        <div class="row cl">
                            <label class="form-label col-1">开始时间：</label>
                            <div class="formControls col-2">
                                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss'})" name="finfodt1" id="finfodt1" class="input-text Wdate" />
                            </div>

                            <label class="form-label col-1">结束时间：</label>
                            <div class="formControls col-2">
                                <input type="text" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd  HH:mm:ss'})" name="finfodt2" id="finfodt2" class="input-text Wdate" />
                            </div>


                            <label class="form-label col-1">作业人员：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfofv3" id="finfofv3" readonly="readonly" placeholder="右边选择或搜索选择" />
                                <input type="hidden" id="finfofv2" name="finfofv2" />
                            </div>
                            <div class="col-3 layui-form">
                                <select name="inoutusernamesel" id='inoutusernamesel' lay-filter="testselect" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1">作业工具：</label>
                            <div class="col-2 layui-form">
                                <select name="finfofv5" id='finfofv5' lay-filter="testselect2" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>
                            <label class="form-label col-1">作业说明：</label>
                            <div class="formControls col-5">
                                <input type="text" class="input-text" name="finfofv6" id="finfofv6" />
                            </div>
                        </div>
                        <div class="row cl" style="display: none;">
                            <label class="form-label col-1">投入品2：</label>
                            <div class="col-2 layui-form">
                                <select name="ftjpid" id='ftjpid' lay-filter="ftjpid" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                                <input type="hidden" id="ftjpname" name="ftjpname" value="" />
                                <input type="hidden" id="ftjpunit" name="ftjpunit" value="" />
                            </div>
                            <label class="form-label col-1">投入量：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="ftjpcount" id="ftjpcount" placeholder="投入量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="ftjpprice" id="ftjpprice" placeholder="单价" value="0" />
                            </div>
                        </div>
                        <div class="row cl">
                            <label class="form-label col-1">投入品：</label>
                            <div class="col-5">
                                <input type="text" class="input-text" name="fplantjpstoreinfo" id="fplantjpstoreinfo" readonly="true" style="background-color: #cccccc;" />
                            </div>
                            <div class="col-2 layui-form">
                                <select name="fplantjpstoreid" id='fplantjpstoreid' lay-filter="fplantjpstoreid" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>

                                <input type="hidden" id="fplantjpstorename" name="fplantjpstorename" value="" />
                                <input type="hidden" id="fplantjpstoreunit" name="fplantjpstoreunit" value="" />
                            </div>
                            <label class="form-label col-1">数量：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fplantjpcount" id="fplantjpcount" placeholder="数量" value="0" />
                            </div>
                            <label class="form-label col-1">单价：</label>
                            <div class="formControls col-1">
                                <input type="text" class="input-text" name="fplantjpprice" id="fplantjpprice" placeholder="单价" value="0" />
                            </div>
                        </div>
                        <div class="row cl" id="divtrfor8">
                            <!--植保特殊数据-->
                            <label class="form-label col-1" style="display: none;">防治对象：</label>
                            <div class="col-2 layui-form" style="display: none;">
                                <select name="finfofv10" id='finfofv10' lay-filter="testselect5" lay-verify="required" lay-search="">
                                    <option value="">直接选择或搜索选择</option>
                                </select>
                            </div>

                            <label class="form-label col-1">工时：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="fworktime" id="fworktime" placeholder="工时" value="0" />
                            </div>
                            <label class="form-label col-1">工时单价：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="fworktimeprice" id="fworktimeprice" placeholder="工时单价" value="0" />
                            </div>
                        </div>
                        <div class="row cl" id="divtrfor6" style="display: none;">
                            <!--播种特殊数据-->
                            <label class="form-label col-1">播种方式：</label>
                            <div class="formControls col-1">
                                <span class="select-box">
                                    <select class="select" name="finfofv9" id="finfofv9">
                                        <option value="直播">直播</option>
                                        <option value="移植">移植</option>
                                    </select>
                                </span>
                            </div>
                            <label class="form-label col-1">播种量：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfonv2" id="finfonv2" placeholder="播种量" value="0" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" />
                            </div>
                            <div class="col-1"></div>



                            <!--报废特殊数据-->
                            <!--   <label class="form-label col-1">报废面积：</label>
                            <div class="formControls col-3">
                                <input type="text" class="input-text" name="finfonv4" id="finfonv4" placeholder="报废面积" value="0" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" />
                            </div>-->
                            <!--  <label class="form-label col-1">报废原因：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfofv12" id="finfofv12" placeholder="报废原因" />
                            </div>-->



                        </div>
                        <div class="row cl" id="divtrfor11" style="display: none;">
                            <!--采摘特殊数据-->
                            <label class="form-label col-1">采摘重量：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfonv3" id="finfonv3" placeholder="采摘重量" value="0" datatype="/^-?[1-9]+(\.\d+)?$|^-?0(\.\d+)?$|^-?[1-9]+[0-9]*(\.\d+)?$/" />
                            </div>
                            <div class="formControls col-1"></div>
                            <label class="form-label col-1">采摘状态：</label>
                            <div class="formControls col-2">
                                <input type="text" class="input-text" name="finfofv11" id="finfofv11" readonly="true" value="待入库" style="background-color: #cccccc;" />
                            </div>
                            <div class="formControls col-1"></div>
                        </div>

                    </div>
                </div>
                <div class="tabCon" id="divtab2">
                    <div id="divshow2">
                        <div class="row cl">
                            <input type="hidden" id="finfoimg1" name="finfoimg1" value="" />
                            <div class="col-5">作业图片1<img id="imgExist1" src="../defaultimg/hcrainaddimg.jpg" width="210px" height="250px"></div>
                            <div class="col-1">
                                <button onclick="addhcrainImgAll('finfoimg1','imgExist1');" class="btn btn-default radius" type="button">上传</button>
                            </div>

                            <input type="hidden" id="finfoimg2" name="finfoimg2" value="" />
                            <div class="col-5">作业图片2<img id="imgExist2" src="../defaultimg/hcrainaddimg.jpg" width="210px" height="250px"></div>
                            <div class="col-1">
                                <button onclick="addhcrainImgAll('finfoimg2','imgExist2');" class="btn btn-default radius" type="button">上传</button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="tabCon" id="divtab3">
                    <div id="divshow3">
                        <div class="row cl">
                        </div>


                    </div>
                </div>
            </div>
            <div class="cl" style="display: none;" id="fold_category">
                <ul id="Huifold2" class="Huifold">
                    <li class="item">
                        <h4>基本设置<b>+</b></h4>
                        <div class="info" id="divfold1" style="display: block;">
                        </div>
                    </li>
                    <li class="item">
                        <h4>基本设置2<b>+</b></h4>
                        <div class="info" id="divfold2" style="display: block;">
                        </div>
                    </li>
                    <li class="item">
                        <h4>基本设置3<b>+</b></h4>
                        <div class="info" id="divfold3" style="display: block;"></div>
                    </li>
                </ul>
            </div>
            <div class="row cl">
                <div class="col-6 col-offset-4">
                    <button onclick="changeshowtype();" class="btn btn-danger radius" type="button">切换显示</button>&nbsp;&nbsp;&nbsp;&nbsp;
                    <button class="btn btn-primary radius" type="submit" id="btsub1">提交</button>&nbsp;&nbsp;
                    <button onclick="layer_close();" class="btn btn-default radius" type="button">返回</button>
                </div>
            </div>

        </form>
    </div>
    <script src="../hcjsui/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../lib/layui/layui.js"></script>
    <script type="text/javascript" src="../lib/icheck/jquery.icheck.min.js"></script>
    <script type="text/javascript" src="../lib/Validform/5.3.2/Validform.js"></script>
    <script type="text/javascript" src="../lib/layer/1.9.3/layer.js"></script>
    <script src="../hcjsui/js/_Define.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/hcui.js"></script>
    <script type="text/javascript" src="../js/hcui_au.js"></script>
    <script type="text/javascript" src="ywjs/sctaskworklistnew.js"></script>
    <script type="text/javascript" src="../lib/My97DatePicker/WdatePicker.js"></script>


    <script type="text/javascript">
        var uiform = null;
        var divshowtype = 1;
        //加载处理
        spsetBaseNoBt("hsc_task_info", "id", "hsc_task_info as T", "*", "#tablelist", "hsc_task_info", "作业管理", "hsc_task_info");
        Mhcloadback[0] = "infotypename";
        Mhcloadback[1] = "infoimg1";
        Mhcloadback[2] = "infoimg2";
        Mhcloadback[3] = "infofv5";
        Mhcloadback[4] = "infofv7";
        Mhcloadback[5] = "infofv10";
        var selectworktypeinfo = [];
        var selectInfoDc = []; //地块信息
        var selectTaskInfo = []; //任务信息
        var fplantjpstoreinfo = []; //任务设入品信息
        //HcUiAuloadInfoAuto = false;//将自动加载，设置为false（禁用自动加载）
        var loadisOk = 0;
        var needstoreoutid = -1;//要同步出库 物品的库存ID
        //加载处理
        hcui_ajaxasync = false;
        function loadin() {
            if (auhcotype == "edit") {
                ////加载 全部 投入品
                //loadisOk++;
                //hcdoselbyPost("t1.id  as id,concat(t1.producttype,'-',t1.name) as name,unit,price,t1.name as pname", "herp_product as t1", "t1.databranchid=" + HCUser.HCUorg, "", "", "id", function (data) {
                //    loadisOk--;
                //    SetSelectWithArrayIdName("#ftjpid", data);
                //    if (uiform) uiform.render('select');
                //    ftjpidobjinfo = data;
                //    checkload();
                //});
                //工具
                hcdoselbyPost("t1.id  as id,concat(t1.fv3,'-',t1.fv4) as name", "yw_baseinfo as t1  INNER JOIN yw_baseinfo as t2 on  t1.fv1=t2.id", "t1.type=8 and t1.maintype=8 and t1.databranchid=" + HCUser.HCUorg, "", "", "t1.id", function (data) {
                    SetSelectWithArrayIdName("#finfofv5", data);
                    //if (uiform) uiform.render('select');
                });
            }
            else {
                $("#finfodt1").val((new Date()).Format("yyyy-MM-dd hh:mm:ss"));//开始时间
                $("#finfodt2").val((addDate(new Date(), 1)).Format("yyyy-MM-dd hh:mm:ss"));//结束时间
            }
            //加载的库存信息
            hcdoselbyPost("id,concat(spname,'批次:',spbasepc,'-厂家:',spbasecj,'-生产日期:',case when spbasecdate  is null  then '' else   DATE_FORMAT(spbasecdate,'%Y-%m-%d') END  ) as name,spbasepc,spbasecj,spbasecdate,unit,price,spbasezj,count-hasout as count, spname", "herp_inoutorderlist", "databranchid='" + HCUser.HCUorg + "'   and datastate='入库' and count-hasout>0", "", "", "dataaddtime asc", function (datab) {
                SetSelectWithArrayIdName("#fplantjpstoreid", datab);
                fplantjpstoreinfo = datab;
                ////默认加第1个
                //if (fplantjpstoreinfo.length > 0) {
                //    needstoreoutid = fplantjpstoreinfo[0].id;
                //    $('#fplantjpstorename').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).spname);
                //    $('#fplantjpstoreinfo').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).name);
                //    $('#fplantjpcount').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).count);
                //    $('#fplantjpprice').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).price);
                //    $('#fplantjpstoreunit').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).unit);

                //}
                // if (uiform) uiform.render('select');
            });

            //hcdoselbyPost("id,concat('编号:',物品编号,'-名称:',物品名称,'-库存：',库存数量 ) as name,物品名称 spname,1 count,0 price,物品单位 unit",
            //    "view_erp_store", "databranchid=" + HCUser.HCUorg + " and worktypeid in(0," + getUrlParam("urlworknum") + ")", "", "", "id asc", function (datab) {
            //        SetSelectWithArrayIdName("#fplantjpstoreid", datab);
            //        fplantjpstoreinfo = datab;
            //        //默认加第1个
            //        if (fplantjpstoreinfo.length > 0) {
            //            needstoreoutid = fplantjpstoreinfo[0].id;
            //            $('#fplantjpstorename').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).spname);
            //            $('#fplantjpstoreinfo').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).name);
            //            $('#fplantjpcount').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).count);
            //            $('#fplantjpprice').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).price);
            //            $('#fplantjpstoreunit').val(hcgetJsonObjById(fplantjpstoreinfo, needstoreoutid).unit);

            //        }

            //        if (uiform) uiform.render('select');
            //    });

            //地块信息
            hcdoselbyPost("id,concat(fv4,'-',fv1,'-',fv8,'-',fv9,'-',fv6) as name,nv1,fv1,fv8,fv10,fv7,fv9,fv6,fv4,fv11,fv12,fv13,fv14,fv15,fv16,fv17,fv18,fv19,fv20,fv21", "yw_baseinfo", "type=2 and maintype=2 and databranchid=" + HCUser.HCUorg, "", "", "id",
                   function (data) {
                       SetSelectWithArrayIdName("#finfoid", data);
                       selectInfoDc = data;
                       if (getUrlParam("urldcid")) {//指定加载
                           $('#finfoid').val(getUrlParam("urldcid"));
                           $('#finfofv1').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv1);
                           $('#fthistaskinfo').val("");
                           $('#ftaskid').val("0");
                           $('#finfonv1').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).nv1);
                           //任务信息
                           if (getUrlParam("urltaskid")) hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj", "view进行中的任务", "id=" + getUrlParam("urltaskid"), "", "", "id",
                                  function (data) {
                                      selectTaskInfo = data;
                                      data.splice(0, 0, { "id": "0", "name": "不指定任务" });
                                      SetSelectWithArrayIdName("#selecttaskinfo", data);

                                      //默认加第2个
                                      if (data.length > 1) {

                                          $('#ftaskid').val(selectTaskInfo[1].id);
                                          $('#fthistaskinfo').val(selectTaskInfo[1].name);
                                          $('#finfonv1').val(selectTaskInfo[1].taskmj);

                                      }
                                      //  if (uiform) uiform.render('select');
                                  });
                       }
                       //  if (uiform) uiform.render('select');
                   });
            //防治对象
            hcdoselbyPost("t1.id  as id,concat(t1.fv1,'-',t1.fv2) as name", "yw_baseinfo as t1", "t1.type=9 and t1.maintype=9 and t1.databranchid=" + HCUser.HCUorg, "", "", "id", function (data) {
                SetSelectWithArrayIdName("#finfofv10", data);
            });

            if (getUrlParam("action") == "add" || getUrlParam("action") == "addlist") {
                $("#editAction").val(getUrlParam("action"));
                if (getUrlParam("action") == "addlist") $('#finfonv1').attr("readonly", true);
                //thisloadinByAdd();//添加作业记录的加载处理
                // $("#ftaskid").val("0");//任务ID
            }
            //作业类型
            hcdoselbyPost("id,fv1 as name,fv3,fv4", "yw_baseinfo", "type='4' and  maintype='4' and fv3<>'1'", "", "", "id",
             function (data) {
                 SetSelectWithArrayIdName("#finfotypeid", data);
                 selectworktypeinfo = data;

                 if (getUrlParam("urlworktype")) {

                     $("#finfotypeid").val(getUrlParam("urlworktype"));
                     $('#finfotypename').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).name);
                     $('#finfotype').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).fv3);//一级
                     $('#finfobytype1').val(hcgetJsonObjById(selectworktypeinfo, $("#finfotypeid").val()).fv4);//二级
                     loadworkggfv5fv7(false, false, false);

                 }
                 if (uiform) uiform.render('select');
             });
            //人员下拉加载 
            hcdoselbyPost("empid  as id,concat(depname,'-',empname) as name,empname as username,mobile as  tel,depname as address", "view_user", "branchid='" + HCUser.HCUorg + "'", "", "", "id",
                function (data) {
                    SetSelectWithArrayIdName("#inoutusernamesel", data);
                    if (uiform) uiform.render('select');
                    if (getUrlParam("action") == "add" || getUrlParam("action") == "addlist") {
                        var worktypenum = hcgetJsonObjById(selectworktypeinfo, getUrlParam("urlworktype")).fv3;//作业类型
                        var workuserid = null;
                        if (worktypenum == "3" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv11) {//作业人员ID
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv11;
                        }
                        else if (worktypenum == "4" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13;
                        }
                        else if (worktypenum == "5" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv12) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv12;
                        }
                        else if (worktypenum == "6" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv17) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv17;
                        }
                        else if (worktypenum == "7" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv14) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv14;
                        }
                        else if (worktypenum == "8" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv15) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv15;
                        }
                        else if (worktypenum == "9" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv18) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv18;
                        }
                        else if (worktypenum == "10" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv16) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv16;
                        }
                        else if (worktypenum == "11" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv19) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv19;
                        }
                        else if (worktypenum == "12" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv20) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv20;
                        } else if (worktypenum == "13" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv21) {
                            workuserid = hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv21;
                        }
                        if (workuserid) {
                            $("#inoutusernamesel").val(workuserid);
                            $('#finfofv2').val(workuserid);
                            $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                        }
                        else {
                            //默认的人员
                            $("#inoutusernamesel").val(HCUser.HCUide);
                            $('#finfofv2').val(HCUser.HCUide);
                            $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                        }
                        //if (worktypenum == "4" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13) {//底肥人
                        //    $("#inoutusernamesel").val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13);
                        //    $('#finfofv2').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13);
                        //    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                        //}
                        //else if (worktypenum == "4" && hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13) {//底肥人
                        //    $("#inoutusernamesel").val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13);
                        //    $('#finfofv2').val(hcgetJsonObjById(selectInfoDc, getUrlParam("urldcid")).fv13);
                        //    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                        //}
                        //else {
                        //    //默认的人员
                        //    //$("#inoutusernamesel").val(HCUser.HCUide);
                        //    //$('#finfofv2').val(HCUser.HCUide);
                        //    //$('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                        //}
                    }
                });

            if (uiform) uiform.render('select');
            layui.use(['form'], function () {
                uiform = layui.form();
                uiform.on('select(testselect)', function (data) {
                    $('#finfofv2').val(data.value);
                    $('#finfofv3').val($("#inoutusernamesel").find("option:selected").text());
                });

                uiform.on('select(finfotypeid)', function (data) {
                    // $('#finfotypeid').val(data.value);
                    $('#finfotypename').val(hcgetJsonObjById(selectworktypeinfo, data.value).name);
                    $('#finfotype').val(hcgetJsonObjById(selectworktypeinfo, data.value).fv3);//一级
                    $('#finfobytype1').val(hcgetJsonObjById(selectworktypeinfo, data.value).fv4);//二级
                    loadworkggfv5fv7(false, false, false);

                });
                //选择投入品
                uiform.on('select(ftjpid)', function (data) {
                    // $('#finfotypeid').val(data.value);
                    $('#ftjpname').val(hcgetJsonObjById(ftjpidobjinfo, data.value).pname);
                    $('#ftjpunit').val(hcgetJsonObjById(ftjpidobjinfo, data.value).unit);
                });

                //地块选择加载任务
                uiform.on('select(finfoid)', function (data) {
                    $('#finfoid').val(data.value);
                    $('#finfofv1').val(hcgetJsonObjById(selectInfoDc, data.value).fv1);
                    $('#fthistaskinfo').val("");
                    $('#ftaskid').val("0");
                    $('#finfonv1').val(hcgetJsonObjById(selectInfoDc, data.value).nv1);
                    //任务信息
                    hcdoselbyPost("id,concat(tasksctypename,'-',taskmj,'-',tasksctypename,'-',type,'-',taskno) as name,taskmj", "view进行中的任务", "infoid=" + data.value, "", "", "id",
                           function (data) {
                               selectTaskInfo = data;
                               data.splice(0, 0, { "id": "0", "name": "不指定任务" });
                               SetSelectWithArrayIdName("#selecttaskinfo", data);
                               //默认加第2个
                               if (data.length > 1) {
                                   $('#ftaskid').val(selectTaskInfo[1].id);
                                   $('#fthistaskinfo').val(selectTaskInfo[1].name);
                                   $('#finfonv1').val(selectTaskInfo[1].taskmj);
                               }
                               if (uiform) uiform.render('select');
                           });
                });
                //选择任务
                uiform.on('select(selecttaskinfo)', function (data) {

                    $('#ftaskid').val(data.value);
                    $('#finfonv1').val(hcgetJsonObjById(selectTaskInfo, data.value).taskmj);
                    $('#fthistaskinfo').val(hcgetJsonObjById(selectTaskInfo, data.value).name);

                });
                //选择计划的投入品
                uiform.on('select(fplantjpstoreid)', function (data) {
                    // $('#finfotypeid').val(data.value);
                    needstoreoutid = data.value;
                    $('#fplantjpstorename').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).spname);
                    $('#fplantjpstoreinfo').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).name);
                    $('#fplantjpcount').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).count);
                    $('#fplantjpprice').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).price);
                    $('#fplantjpstoreunit').val(hcgetJsonObjById(fplantjpstoreinfo, data.value).unit);

                });
                uiform.render('select');
            });


            $.Huitab("#tab-category .tabBar span", "#tab-category .tabCon", "current", "click", "0");
            $.Huifold("#Huifold2 .item h4", "#Huifold2 .item .info", "", 3, "click"); /*5个参数顺序不可打乱，分别是：相应区,隐藏显示的内容,速度,类型,事件 mouseover click */

        }

        function loadback(data) {
            uiform.render();//这个不能去掉,坑啊
            $("#lb_worktypeshow").html(data["infotypename"] + "作业");//显示作业
            if (data["infoimg1"]) hcrainloadimg("#imgExist1", data["infoimg1"]);
            if (data["infoimg2"]) hcrainloadimg("#imgExist2", data["infoimg2"]);

            hcdoselbyPost("taskstatus", "hsc_task", "id='" + $("#ftaskid").val() + "'", "", "", "id", function (data) {
                if (data[0].taskstatus == "完成" || data[0].taskstatus == "中止") { $("#btsub1").hide(); }
            });
        }
        //切换事件
        function changeshowtype() {
            if (divshowtype == 1) {
                $("#divshow1").appendTo("#divfold1");
                $("#divshow2").appendTo("#divfold2");
                $("#divshow3").appendTo("#divfold3");
                $("#fold_category").show();
                $("#tab-category").hide();

                divshowtype = 2;
            }
            else {
                $("#divshow1").appendTo("#divtab1");
                $("#divshow2").appendTo("#divtab2");
                $("#divshow3").appendTo("#divtab3");
                $("#fold_category").hide();
                $("#tab-category").show();
                divshowtype = 1;
            }

        }
        //重写  提交前数据处理
        function hcrBeforeSub() {
            //$("#fareaname").val($('#fareaid option:selected').text());
            if ($("#finfotypeid").val() == "") {
                layer.msg("请选择作业类型", { icon: 5 });
                return false;
            }
            if ($("#finfoid").val() == "") {
                layer.msg("请选择地块信息", { icon: 5 });
                return false;
            }

        }


        //提交数据后,回调
        function subback(data) {
            if (data.status == "y") {
                //if (auhcotype == "add" && needstoreoutid > 0)//添加底肥
                //{
                //    //更新状态
                //    hcdoedit("herp_store", "id", needstoreoutid, "hasoutall%hcrainself(hasoutall+" + $('#fplantjpcount').val() + ")", function (info2) {
                //        layer.confirm('处理完成!', {
                //            btn: ['返回'] //按钮
                //        }, function (index) {
                //            layer_close();
                //        }, function (index) {
                //            layer_close();
                //        });
                //    });
                //}
                //else
                {
                    layer.confirm('操作完成!', {
                        btn: ['返回'] //按钮
                    }, function (index) {
                        layer_close();
                    }, function (index) {
                        layer_close();
                    });
                }
            }
            else {
                layer.alert(data.info, { icon: 2 });
            }
        }

    </script>
</body>
</html>
